Entry

Base entry class for list widget entries. This is typically built using a BiFunction that supplies the parentElement and an entry index

Author

fzzyhmstrs

Since

0.6.0

Parameters

parentElement

The DynamicListWidget this entry belongs to.

texts

Translatable.Result text set for this entry. This is used when searching entries.

scope

Scope defines the entries personal scope as well as any entry groups this entry owns and/or belongs to. Basic entries will only need to provide the personal scope id, which might be as simple as the index in string form.

visibility

Visibility, default Visibility.VISIBLE. The starting visibility setting for the entry.

Inheritors

Constructors

Link copied to clipboard
constructor(parentElement: DynamicListWidget, texts: Translatable.Result, scope: DynamicListWidget.Scope, visibility: DynamicListWidget.Visibility = Visibility.VISIBLE)

Types

Link copied to clipboard
interface EntryPos : Pos
Link copied to clipboard
Link copied to clipboard
interface SelectableElement : Selectable, Element

Properties

Link copied to clipboard
open override var lastSelected: Element?

getter and setter for the cached element.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val skip: Boolean

Whether the search should exclude this content from search results. This is active state, so can change between true and false as needed.

Link copied to clipboard
open override val texts: Translatable.Result

Functions

Link copied to clipboard
open override fun appendNarrations(builder: NarrationMessageBuilder)

Append narration messages to current NarrationMessageBuilder. The list will handle list position and navigation, the entry should focus on providing title and description information, and internal navigation information as applicable (if there are multiple children in one entry for example)

Link copied to clipboard
open fun appendTitleNarrations(builder: NarrationMessageBuilder)
Link copied to clipboard
fun atY(mouseY: Int): Boolean
Link copied to clipboard
open fun charTyped(chr: Char, modifiers: Int): Boolean
Link copied to clipboard
abstract fun children(): MutableList<out Element>
Link copied to clipboard
open override fun getFocused(): Element?
Link copied to clipboard
open override fun getFocusedPath(): GuiNavigationPath?
Link copied to clipboard
open override fun getNavigationFocus(): ScreenRect
Link copied to clipboard
Link copied to clipboard
open override fun getNavigationPath(navigation: GuiNavigation): GuiNavigationPath?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun handleContext(contextType: ContextType, position: Position): Boolean

Handle a context event. This will be triggered by a parent, typically on key press or mouse click. A parent object can of course also be a context handler, handle context as applicable and then pass the event downstream for further handling.

Link copied to clipboard
open fun hoveredElement(mouseX: Double, mouseY: Double): Optional<Element>
Link copied to clipboard
open fun init()

Applied when the entry is added to an entries list for the first time. Generally this will happen when the Dynamic List is displayed. This may happen more than once, if an entry is removed or added (the entries list is rebuilt).

Link copied to clipboard
open override fun isDragging(): Boolean
Link copied to clipboard
open override fun isFocused(): Boolean
Link copied to clipboard
open override fun isMouseOver(mouseX: Double, mouseY: Double): Boolean
Link copied to clipboard
open fun keyPressed(keyCode: Int, scanCode: Int, modifiers: Int): Boolean
Link copied to clipboard
open fun keyReleased(keyCode: Int, scanCode: Int, modifiers: Int): Boolean
Link copied to clipboard
open override fun mouseClicked(mouseX: Double, mouseY: Double, button: Int): Boolean
Link copied to clipboard
open fun mouseDragged(mouseX: Double, mouseY: Double, button: Int, deltaX: Double, deltaY: Double): Boolean
Link copied to clipboard
open fun mouseMoved(mouseX: Double, mouseY: Double)
Link copied to clipboard
open fun mouseReleased(mouseX: Double, mouseY: Double, button: Int): Boolean
Link copied to clipboard
open fun mouseScrolled(mouseX: Double, mouseY: Double, horizontalAmount: Double, verticalAmount: Double): Boolean
Link copied to clipboard
fun onAdd(parentPos: Pos, previous: DynamicListWidget.Entry?, last: Boolean)
Link copied to clipboard
open fun onResize()

Applied when the parent Dynamic List is resized. This should handle any reorganization/repositioning of children.

Link copied to clipboard
open fun onScroll(dY: Int)

Applied when the Dynamic List is scrolled. Use this to move children to match the scroll, as applicable.

Link copied to clipboard
open override fun popLast()

Indicates that the overlay has been removed and the parent should return focus to the cached element, if any, in lastSelected

Link copied to clipboard
open override fun provideContext(builder: ContextResultBuilder)

Add a set of grouped context action builders to a result

Link copied to clipboard
open override fun pushLast()

Indicates to the parent element to cache it's current focused element. The current focused element should be stored in lastSelected

Link copied to clipboard
open override fun render(context: DrawContext, mouseX: Int, mouseY: Int, delta: Float)

Renders the entry. This is the base method of CustomListWidget.Entry and generally shouldn't be overridden directly.

Link copied to clipboard
open fun renderBorder(context: DrawContext, x: Int, y: Int, width: Int, height: Int, mouseX: Int, mouseY: Int, hovered: Boolean, focused: Boolean, delta: Float)

Render call for drawing a border on the entry, as applicable. This happens before, therefor "under" the main entry render calls.

Link copied to clipboard
abstract fun renderEntry(context: DrawContext, x: Int, y: Int, width: Int, height: Int, mouseX: Int, mouseY: Int, hovered: Boolean, focused: Boolean, delta: Float)

Base render method for the entry.

Link copied to clipboard
fun renderExtras(context: DrawContext, mouseX: Int, mouseY: Int, delta: Float)

open fun renderExtras(context: DrawContext, x: Int, y: Int, width: Int, height: Int, mouseX: Int, mouseY: Int, hovered: Boolean, focused: Boolean, delta: Float)

Render call for rendering anything else related to the entry. This call is not bound by a render scissor, so you can draw "out of bounds" as needed.

Link copied to clipboard
open fun renderHighlight(context: DrawContext, x: Int, y: Int, width: Int, height: Int, mouseX: Int, mouseY: Int, hovered: Boolean, focused: Boolean, delta: Float)

Render call for drawing an entry background highlight. This happens before, therefor "under" both the entry and border render calls

Link copied to clipboard
open fun resetHover(mouseX: Double, mouseY: Double)

When called the parent element should reselect a hovered element based on the supplied mouse positions, if it tracks such things

Link copied to clipboard
fun scroll(dY: Int)
Link copied to clipboard

The children of the entry that comply to SelectableElement, that is both Selectable and an Element

Link copied to clipboard
open override fun setDragging(dragging: Boolean)
Link copied to clipboard
open override fun setFocused(focused: Boolean)
open override fun setFocused(focused: Element?)
Link copied to clipboard
open override fun toString(): String